Shoes.setup do
  gem "oauth"
end
Shoes.app do
   require'oauth'
   require 'oauth/consumer'
   api_key ="012c4c877ccfe4120384e596766fac36"
   api_key_secret ="29819e878b84ae68"
   @consumer=OAuth::Consumer.new(
                                   api_key,
                                   api_key_secret,
                                   {
                                       :site=>"http://www.douban.com",
                                       :request_token_path=>"/service/auth/request_token",
                                       :access_token_path=>"/service/auth/access_token",
                                       :authorize_path=>"/service/auth/authorize",
                                       :signature_method=>"HMAC-SHA1",
                                       :scheme=>:header,
                                       :realm=>"http://yoursite.com"
                                   }
                                 )
    button "Got Authorized!" do
      @request_token=@consumer.get_request_token
      url=@request_token.authorize_url
        para link("Click here!",:click=>url)
    end
    button "Authorize Finished" do
      @access_token=@request_token.get_access_token
      @access_token = OAuth::AccessToken.new(
                                               OAuth::Consumer.new(
                                                                     api_key,
                                                                     api_key_secret,
                                                                     {
                                                                         :site=>"http://api.douban.com",
                                                                         :scheme=>:header,
                                                                         :signature_method=>"HMAC-SHA1",
                                                                         :realm=>"http://yoursite.com"
                                                                     }
                                                                   ),
                                               @access_token.token,
                                               @access_token.secret
                                              )
        para @access_token.get("/people/hooopo").body,:font=>"song"
    end
end